package com.alienlab.utils;

import com.alibaba.fastjson.JSONArray;

import java.util.Properties;

public class NewsLoadUrlRun implements Runnable {
	private JSONArray jsonArray;
	private long time_now;
	private Properties propertyConfig = new PropertyConfig("jdbc.properties").getProperties();
	private String dummy_path=  propertyConfig.getProperty("dummy-path");
	public NewsLoadUrlRun(JSONArray jsonArray, long time_now) {
		super();
		this.jsonArray = jsonArray;
		this.time_now = time_now;
	}

	public JSONArray getJsonArray() {
		return jsonArray;
	}

	public void setJsonArray(JSONArray jsonArray) {
		this.jsonArray = jsonArray;
	}

	public long getTime_now() {
		return time_now;
	}

	public void setTime_now(long time_now) {
		this.time_now = time_now;
	}

	@Override
	public void run() {
		String today = NowTime.getNowTime("yyyy-MM-dd"); 
		String getpath = ""+dummy_path+"";
		getpath = getpath.replace("\\", "\\\\");
		for (int i = 0; i < this.getJsonArray().size(); i++) {
			HttpDownload.download(this.getJsonArray().getString(i),
					"" + getpath + "\\" + today + "\\" + today + "-" + this.getTime_now() + "-" + i + ".pdf");
		}

	}

}
